package com.jjh.springframework.test.common;

import com.jjh.springframework.bean.BeansException;
import com.jjh.springframework.bean.PropertyValue;
import com.jjh.springframework.bean.PropertyValues;
import com.jjh.springframework.bean.factory.ConfigurableListableBeanFactory;
import com.jjh.springframework.bean.factory.config.BeanDefinition;
import com.jjh.springframework.bean.factory.config.BeanFactoryPostProcessor;

/**
 * MyBeanFactoryPostProcessor
 *
 * @author jjh
 * @date 2021/06/20
 **/
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userService");
        PropertyValues propertyValues = beanDefinition.getPropertyValues();
        propertyValues.addPropertyValue(new PropertyValue("company", "字节跳"));
    }
}
